<%@include file="common/common.jsp" %>
<!DOCTYPE html>
<html lang=en>
<head>
<meta charset=utf-8>

<meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1">
<meta name=format-detection content="telephone=no">

<meta name=robots content="noindex,nofollow,noarchive">

<meta name=author content="https://github.com/ErikDubbelboer/">

<title></title>

<link rel=stylesheet href="css/common.css?v1-1-1" media=all>
<link rel=stylesheet href="css/frame.css?v1-1-1" media=all>

<link rel="shortcut icon" href="images/favicon.png">

<script src="js/jquery.js?v1-1-1"></script>
<script src="js/frame.js?v1-1-1"></script>

</head>
<body>
<%for (HashMap<String, String> server : servers) {%>
	<div class="server">
  <h2><%=server.get(HOST) %>:<%=server.get(PORT) %></h2>

  <%
  	Jedis rd = new Jedis(server.get(HOST).toString(),Integer.parseInt(server.get(PORT)));
	if(server.get(PASSWORD) != null ) {
		rd.auth(server.get(PASSWORD));
	}
  	boolean running = false;	
  	try{
  		running = "PONG".equals(rd.ping());
  	}catch(Exception e) {
  	}
  	if(!running){
  %>
  <div style="text-align:center;color:red">Server Down</div>
  <%} else { 
  	String info = rd.info();
  	HashMap<String, String> infoMap = parseInfo(info);
  %>

  <table>

  <tr><td><div>Redis version:</div></td><td><div><%=infoMap.get("redis_version") %></div></td></tr>

  <tr><td><div>Keys:</div></td><td><div><%=rd.dbSize() %></div></td></tr>

  <tr><td><div>Memory used:</div></td><td><div><%=Long.parseLong(infoMap.get("used_memory").toString())/2014L %> kb</div></td></tr>

  <tr><td><div>Uptime:</div></td><td><div><%=infoMap.get("uptime_in_days") %> days</div></td></tr>

  <%--<tr><td><div>Last save:</div></td><td><div><%=infoMap.get("rdb_last_save_time") %> <a href="save.jsp?s=<%=selectServer%>"><img src="images/save.png" width="16" height="16" title="Save Now" alt="[S]" class="imgbut"></a></div></td></tr>
--%>
  </table>
  <%} %>
  </div>
  <%} %>
	
<p class="clear">
<a href="http://git.oschina.net/zhangfeng0103/jspRedisAdmin" target="_blank">jspRedisAdmin on oschina</a>
</p>
<p class="clear">
forked from <a href="https://github.com/ErikDubbelboer/jspRedisAdmin" target="_blank">phpRedisAdmin on GitHub</a>
</p>
<p>
<a href="http://redis.io/documentation" target="_blank">Redis Documentation</a>
</p>
</body>
</html>